// pages/personal/personal.js
var utils = require('../../utils/util.js');
var app=getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        deposit:0,
        couponnum:0
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that=this;
        that.personalInfo();
    },
    //我的个人信息
    personalInfo: function (e) {
        var that = this;
        utils.http("/api/v1/member/index",{
        }, function (res) {
            that.setData({
                info: res.datas,
                deposit:res.datas.deposit,
                couponnum: res.datas.coupon_num
            })
        })
    },
    //开通会员页面
    onOpenVipTap: function (e) {
        var that = this;
        that.setData({
            ishidden: true
        })
        if (that.data.info.is_vip==1){
            wx.switchTab({
                url: '../vipmember/vipmember',
            })
        }else{
        wx.navigateTo({
            url: '../openvip/openvip?viptype=0'
            })
        }
    },
    //跳转余额页面
    onBalanceTap:function(e){
        wx.navigateTo({
            url: '../personal/balance/balance',
        })
    },
    //跳转优惠券页面
    onCouponTap: function (e) {
        wx.navigateTo({
            url: '../personal/personalcoupon/personalcoupon',
        })
    },
    //跳入我的地址页面
    onMyAddressTap:function(e){
        app.globalData.typeaddress =1
        wx.navigateTo({
            url: '../personal/myaddress/myaddress?typeaddress=' + app.globalData.typeaddress,
        })
    },
    //跳入我的订单
    onMyorderTap:function(e){
        wx.navigateTo({
            url: '../personal/myorder/myorder',
        })
    },
    //我的邀请
    myinvitationTap:function(e){
        wx.navigateTo({
            url: '../personal/myinvitation/myinvitation',
        })
    },
    //我要加盟
    onWantjoinTap:function(e){
        wx.navigateTo({
            url: '../personal/wantjoin/wantjoin',
        })
    },
    //我的拼购
    onSpellPurchaseTap:function(e){
        wx.navigateTo({
            url: '../personal/spellpurchase/spellpurchase',
        })
    },
    //我的众筹
    oncrowdraisingTap: function (e) {
        wx.navigateTo({
            url: '../personal/mycrowdraising/mycrowdraising',
        })
    },
    //跳入物流进度
    onLogisticsProgressTap: function (e) {
        wx.navigateTo({
            url: '../personal/logisticsprogress/logisticsprogress'
        })
    },
    //问题反馈
    myfeedbackTap:function(e){
        wx.navigateTo({
            url: '../personal/myfeedback/myfeedback'
        })
    },
    //联系客服
    onCustomerServiceTap:function(e){
        wx.navigateTo({
            url: '../personal/contact/contact', 
        })
    },
    //商户和果农端进入登录页面
    onLoginTap:function(e){
    wx.navigateTo({
        url: '../login/login',
    })
    },
    //我的通知
    onMynoticeTap:function(e){
        wx.navigateTo({
            url: '../personal/mynotice/mynotice',
        }) 
    }
})